import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate"
import user from './modules/user'
import common from './modules/common'
import tags from './modules/tags'
import logs from './modules/logs'
import getters from './getters'

Vue.use(Vuex)

const store = new Vuex.Store({
    modules: {
        user,
        common,
        logs,
        tags
    },
    getters,
    plugins: [createPersistedState({
      storage: window.sessionStorage,
      reducer(val) {
        return {
          common: val.common,
          logs: val.logs,
          tags: val.tags,
          user: val.user
        }
      }
    })]
})

export default store